object BasicFunctionDemo extends App {
  def printWelcomeMessage(): Unit = {
    println("===== 学生信息查询系统 =====")
    println("欢迎使用学生信息查询功能")
    println("==========================")
  }

  def getStudentName(studentId: String): String = {
    val studentMap = Map(
      "s2025001" -> "张三",
      "s2025002" -> "李四",
      "s2025003" -> "王五",
      "s2025004" -> "赵六"
    )
    studentMap.getOrElse(studentId, "未知学生")
  }

  def calculateAverageScore(scores: List[Int]): Double = {
    if (scores.isEmpty) 0.0
    else scores.sum.toDouble / scores.size
  }

  printWelcomeMessage()

  val studentId = "s2025002"
  val studentName = getStudentName(studentId)
  println(s"\n学生 $studentId 的姓名是：$studentName")

  val mathScores = List(85, 92, 88, 90, 86)
  val avg = calculateAverageScore(mathScores)
  println(s"该学生的数学平均分是：$avg")

  println(s"平均分是否及格：${calculateAverageScore(mathScores) >= 60}")
}
//第十周(11.03【动手练习1】：查询学生的基本信息和计算学生的平均成绩